package com.entmanage.base.oa.service.impl;

import java.util.List;
import com.entmanage.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.entmanage.common.utils.SecurityUtils;
import com.entmanage.base.oa.mapper.OaReimbursementDetailMapper;
import com.entmanage.base.oa.domain.OaReimbursementDetail;
import com.entmanage.base.oa.service.IOaReimbursementDetailService;

/**
 * OA报销申请-费用明细Service业务层处理
 *
 * @author lsq
 * @date 2025-09-25
 */
@Service
public class OaReimbursementDetailServiceImpl implements IOaReimbursementDetailService
{
    @Autowired
    private OaReimbursementDetailMapper oaReimbursementDetailMapper;

    /**
     * 查询OA报销申请-费用明细
     *
     * @param id OA报销申请-费用明细主键
     * @return OA报销申请-费用明细
     */
    @Override
    public OaReimbursementDetail selectOaReimbursementDetailById(Long id)
    {
        return oaReimbursementDetailMapper.selectOaReimbursementDetailById(id);
    }

    /**
     * 查询OA报销申请-费用明细列表
     *
     * @param oaReimbursementDetail OA报销申请-费用明细
     * @return OA报销申请-费用明细
     */
    @Override
    public List<OaReimbursementDetail> selectOaReimbursementDetailList(OaReimbursementDetail oaReimbursementDetail)
    {
        return oaReimbursementDetailMapper.selectOaReimbursementDetailList(oaReimbursementDetail);
    }

    /**
     * 新增OA报销申请-费用明细
     *
     * @param oaReimbursementDetail OA报销申请-费用明细
     * @return 结果
     */
    @Override
    public int insertOaReimbursementDetail(OaReimbursementDetail oaReimbursementDetail)
    {
        // 保存用户和部门ID
        oaReimbursementDetail.setUserId(SecurityUtils.getUserId());
        oaReimbursementDetail.setDeptId(SecurityUtils.getDeptId());
        oaReimbursementDetail.setCreateTime(DateUtils.getNowDate());
    oaReimbursementDetail.setCreateBy(SecurityUtils.getUsername());
        return oaReimbursementDetailMapper.insertOaReimbursementDetail(oaReimbursementDetail);
    }

    /**
     * 修改OA报销申请-费用明细
     *
     * @param oaReimbursementDetail OA报销申请-费用明细
     * @return 结果
     */
    @Override
    public int updateOaReimbursementDetail(OaReimbursementDetail oaReimbursementDetail)
    {
        oaReimbursementDetail.setUpdateTime(DateUtils.getNowDate());
    oaReimbursementDetail.setUpdateBy(SecurityUtils.getUsername());
        return oaReimbursementDetailMapper.updateOaReimbursementDetail(oaReimbursementDetail);
    }

    /**
     * 批量删除OA报销申请-费用明细
     *
     * @param ids 需要删除的OA报销申请-费用明细主键
     * @return 结果
     */
    @Override
    public int deleteOaReimbursementDetailByIds(Long[] ids)
    {
        return oaReimbursementDetailMapper.deleteOaReimbursementDetailByIds(ids);
    }

    /**
     * 删除OA报销申请-费用明细信息
     *
     * @param id OA报销申请-费用明细主键
     * @return 结果
     */
    @Override
    public int deleteOaReimbursementDetailById(Long id)
    {
        return oaReimbursementDetailMapper.deleteOaReimbursementDetailById(id);
    }
}
